#include "adminwidget.h"
#include "ui_adminwidget.h"

AdminWidget::AdminWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::AdminWidget) {
    ui->setupUi(this);

    m_pDM = new DeviceMgt(this);

    m_stackedWidget = new QStackedWidget(this);

    ui->mainLayout->addWidget(m_stackedWidget);

    m_stackedWidget->addWidget(m_pDM);

    connect(ui->btnDM, &QPushButton::clicked, this, [=](){
        m_stackedWidget->setCurrentIndex(0);
    });
}

AdminWidget::~AdminWidget() {
    delete m_stackedWidget;
    delete ui;
}

void AdminWidget::onAdminName(const QString &UserName) {
    ui->btnUserName->setText(UserName);
}
